﻿namespace
    ``Concerning the test framework``

open FSpec
open Gallio.Framework.Utilities 
open System
open System.Reflection

module ``When the framework is loaded``=
    let sampleRunner = new SampleRunner()
    let asm = Assembly.Load("Examples.FSpec")
    let ty = asm.GetType("Simple.Tests")

    let ``it pass a passing test``()=
        sampleRunner.AddMethod(ty, "it pass this test" )
        sampleRunner.Run()
        let result = sampleRunner.Result 
        result.Statistics.AssertCount |> should.equal 1
        result.Statistics.FailedCount |> should.equal 0
        result.Statistics.PassedCount |> should.equal 1
        result.Statistics.RunCount |> should.equal 1
        result.Statistics.TestCount |> should.equal 1

    let ``it fail a failing test``()=
//        let sampleRunner = new SampleRunner()
//        let asm = Assembly.Load("Examples.FSpec")
//        let ty = asm.GetType("Simple.Tests")

        sampleRunner.AddMethod(ty, "it fail this test" )
        sampleRunner.Run()
        let result = sampleRunner.Result 
        result.Statistics.AssertCount |> should.equal 1
        result.Statistics.FailedCount |> should.equal 1
        result.Statistics.PassedCount |> should.equal 0
        result.Statistics.RunCount |> should.equal 1
        result.Statistics.TestCount |> should.equal 1